﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AgnisEbmtTranslator
{
    /// <summary>
    /// Class used to send the answer to the Agnis question-value that we are trying to match.
    /// If the EBMT database contains a valid match for the current Field-Value combination,
    /// the property hasAResponse will be true.
    /// If there is not match or the ebmt database could not respond to this combination,
    /// the property hasAResponse will be false.
    /// if hasAResponse is false, the other properties don't need to be filled in because will be ignored.
    /// </summary>
    public class TranslationAnswer:IEquatable<TranslationAnswer>
        {
            public bool hasAResponse; //The flag telling us if a match was found or not for the current combination.
            public bool normalized; //Normalized or non-Normalized module.
            public bool freeTextEntry;// Flag telling us if this is a free text entry answer.
            public int valueMeaningPublicId;// Value meaning public ID of this answer.
            public string textAnswer;//When the answer is free text entry, this is the text of the answer.
            public string conditionID;
            public TranslationAnswer()
            {

            }
            public TranslationAnswer(String condID)
            {
                conditionID = condID;
            }
            public TranslationAnswer(bool response, int _valuePublicId)
            {
                this.hasAResponse = response;
                this.valueMeaningPublicId = _valuePublicId;
            }

            public String ConditionId
            {
                get{return conditionID;}
                set{conditionID=value;}
            }

            #region IEquatable<TranslationAnswer> Membres

            public bool Equals(TranslationAnswer other)
            {
                if (other.ConditionId == this.ConditionId)
                { return true; }
                else
                { return false; }
            }

            #endregion
        }
}
